package com.hfkh;

import java.util.Scanner;

/**
 * @Author MDD
 * @Description
 * @Version
 * @Date
 **/
public class Code02 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入学生姓名：");
        String  name = sc.nextLine();
        int score = 0;
        double sumScore = 0;
        int count = 0;
        boolean isNegative = false;
        double avg = 0;
        for (int i = 0; i < 4; i++) {
            System.out.print("第"+(i+1)+"门成绩为：");
            score = sc.nextInt();
            if (score<0||score>100){
                isNegative = true;
                break;
            }
            sumScore += score;
            if (score<80){
                continue;
            }
            count++;
        }
        avg = sumScore/5;
        if (!isNegative){
            double ratio = count / 5 * 100;
            System.out.print(name+"的平均成绩是："+avg);
            System.out.println("80分及以上所占比例为："+ratio+"%");
        }
        else {
            System.out.println("请重新输入正确的成绩分数1-100之间的整数");
        }
    }
}
